<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script src="//cdn.bootcss.com/stomp.js/2.3.2/stomp.js"></script>
	<script src="//cdn.bootcss.com/sockjs-client/1.1.2/sockjs.js"></script>
	<script type="text/javascript">
		var url = 'marcopolo';
		var ws = new SockJS(url);
		
		var stomp = Stomp.over(ws);
		
		var payload = JSON.stringify({'message':'Marco!'});
		
		stomp.connect("","",function(frame){
			console.log(frame)
			stomp.subscribe("/topic/marco-s",function(m){
				console.log(m);
			});
			stomp.send("/app/marco-s",{},payload);
		});
		
		stomp.onClosed = function(){
			console.log("stomp 关闭")
		}
		
	
	</script>
</body>
</html>